package net.myjung.hibernate;

import java.util.ArrayList;
import java.util.List;

import net.myjung.model.annotation.MdlAttribute;
import net.myjung.model.annotation.MdlClass;
import net.myjung.model.annotation.MdlElement;

@MdlClass(name = "Class")
@SuppressWarnings("serial")
public class HbnClass extends HbnObject {
	@MdlAttribute(type = "string")
	private String table;
	@MdlElement(type = "net.myjung.hibernate.Id")
	private HbnId id;
	@MdlElement(name = "composite-id", singular = "key-property", generic = "net.myjung.hibernate.HbnKey_property", type = "net.myjung.hibernate.Key-property")
	private List<HbnKey_property> composite_id;
	@MdlElement(type = "net.myjung.hibernate.Property")
	private List<HbnProperty> property;
	@MdlElement(name = "many-to-one", type = "net.myjung.hibernate.Many-to-one")
	private List<HbnMany_to_one> many_to_one;
	@MdlElement(type = "net.myjung.hibernate.List")
	private List<HbnList> list;
	@MdlElement(type = "net.myjung.hibernate.Set")
	private List<HbnSet> set;

	public String getTable() {
		return table;
	}
	public void setTable(String table) {
		this.table = table;
	}
	public HbnId getId() {
		return id;
	}
	public void setId(HbnId id) {
		this.id = id;
	}
	public List<HbnKey_property> getComposite_id() {
		return composite_id;
	}
	public void setComposite_id(List<HbnKey_property> composite_id) {
		this.composite_id = composite_id;
	}
	public void addKey_property(HbnKey_property key_property) {
		if (this.composite_id == null)
			this.composite_id = new ArrayList<HbnKey_property>();
		this.composite_id.add(key_property);
	}
	public void removeKey_property(HbnKey_property key_property) {
		if (this.composite_id == null || !this.composite_id.contains(key_property))
			return;
		this.composite_id.remove(key_property);
	}
	public List<HbnProperty> getProperty() {
		return property;
	}
	public void setProperty(List<HbnProperty> property) {
		this.property = property;
	}
	public void addProperty(HbnProperty property) {
		if (this.property == null)
			this.property = new ArrayList<HbnProperty>();
		this.property.add(property);
	}
	public void removeProperty(HbnProperty property) {
		if (this.property == null || !this.property.contains(property))
			return;
		this.property.remove(property);
	}
	public List<HbnMany_to_one> getMany_to_one() {
		return many_to_one;
	}
	public void setMany_to_one(List<HbnMany_to_one> many_to_one) {
		this.many_to_one = many_to_one;
	}
	public void addMany_to_one(HbnMany_to_one many_to_one) {
		if (this.many_to_one == null)
			this.many_to_one = new ArrayList<HbnMany_to_one>();
		this.many_to_one.add(many_to_one);
	}
	public void removeMany_to_one(HbnMany_to_one many_to_one) {
		if (this.many_to_one == null || !this.many_to_one.contains(many_to_one))
			return;
		this.many_to_one.remove(many_to_one);
	}
	public List<HbnList> getList() {
		return list;
	}
	public void setList(List<HbnList> list) {
		this.list = list;
	}
	public void addList(HbnList list) {
		if (this.list == null)
			this.list = new ArrayList<HbnList>();
		this.list.add(list);
	}
	public void removeList(HbnList list) {
		if (this.list == null || !this.list.contains(list))
			return;
		this.list.remove(list);
	}
	public List<HbnSet> getSet() {
		return set;
	}
	public void setSet(List<HbnSet> set) {
		this.set = set;
	}
	public void addSet(HbnSet set) {
		if (this.set == null)
			this.set = new ArrayList<HbnSet>();
		this.set.add(set);
	}
	public void removeSet(HbnSet set) {
		if (this.set == null || !this.set.contains(set))
			return;
		this.set.remove(set);
	}
}